//
//  SetHvacTempApi.m
//  AFNetworking
//
//  Created by Henry on 2023/3/1.
//

#import "SetHvacTempApi.h"
@interface SetHvacTempApi()

@property(nonatomic,assign)float temp;

@end
@implementation SetHvacTempApi

-(id)initWithDevId:(NSString *)thingName withTemp:(float)temp{
    if(self = [super init]){
        self.thingName = thingName;
        self.temp = temp;
    }
    return self;
}


-(id)getTopic{
    return [NSString stringWithFormat:@"/command/platform/%@",self.thingName];
}

-(id)getCommandContent{
    
    NSString *de = [NSString stringWithFormat:@"%0.1f",self.temp];
    if([de hasSuffix:@".0"]){
        de = [de stringByReplacingOccurrencesOfString:@".0" withString:@""];
    }
    
    return [NSString stringWithFormat:@"{\"command\":\"SetTargetTemperature\",\"param\":{\"value\":%@}}",de];

}

-(id)getSubcribeTopic{
    return [NSString stringWithFormat:@"$aws/things/%@/shadow/name/%@/update/accepted",self.thingName,self.thingTypeName];
}


@end
